package com.eachann.launch.starter.sample

import android.app.Application
import androidx.core.content.ContextCompat
import com.eachann.launch.starter.TaskDispatcher
import com.hunter.library.debug.HunterDebug
import com.hunter.library.debug.HunterDebugClass
import com.scwang.smartrefresh.header.MaterialHeader
import com.scwang.smartrefresh.layout.SmartRefreshLayout
import com.tencent.bugly.crashreport.CrashReport
@HunterDebugClass
class App :Application() {
    override fun onCreate() {
        super.onCreate()
//        initNormalSeq(this)//onCreate[35ms]="void"
        TaskDispatcher.init(this)
        TaskDispatcher.createInstance()
            .addTask(InitBuglyTask())
            .addTask(InitSmartRefreshLayoutTask())
            .start()
    }
    private fun initNormalSeq(mContext:Application){
        CrashReport.initCrashReport(mContext, "8a37e3b7c7", false)
        SmartRefreshLayout.setDefaultRefreshHeaderCreator { context, layout ->
            layout.setEnableHeaderTranslationContent(false)
            MaterialHeader(context).setColorSchemeColors(
                ContextCompat.getColor(
                    context,
                    R.color.colorPrimary
                )
            )
        }
    }
}